package com.barcamp.manager;

import java.util.List;

//import com.barcamp.bean.EventTypeBean;
import com.barcamp.dao.RegisterDao;

//import com.barcamp.entity.EventType;
import com.barcamp.entity.RegisterData;
import com.exception.PersistenceException;

public class RegisterManager {
	
	private RegisterDao registerDao;
	private List<RegisterData> resultList;
	private RegisterData data;

	public void setData(RegisterData data) {
		this.data = data;
	}
	public RegisterDao getRegisterDao() {
		return registerDao;
	}
	public void setRegisterDao(RegisterDao registerDao) {
		this.registerDao = registerDao;
	}
	public void registerAttendance(RegisterData registerData){
		try {
			registerDao.registerAttendance(registerData);
		} catch (PersistenceException e) {
			e.printStackTrace();
		}
	}
	public List<RegisterData> findRegisterData(){
		try{
			resultList = registerDao.findRegisterData();
		}catch (PersistenceException e) {
			e.printStackTrace();
		}
		return resultList;
	}
	
	public List<RegisterData> findByPresentStatus(int value){
		try{
			resultList = registerDao.findByPresentStatus(value);
		}catch (PersistenceException e) {
			e.printStackTrace();
		}
		return resultList;
	}
	
	public List<RegisterData> findByAbsenceStatus(int id){
		try{

			resultList = registerDao.findByAbsenceStatus(data.getEventId());
			resultList = registerDao.findByAbsenceStatus(id);

		}catch (PersistenceException e) {
			e.printStackTrace();
		}
		return resultList;
	}
	
	public void updateRegister(RegisterData registerData){
		try {
			registerDao.updateRegister(registerData);
		} catch (PersistenceException e) {
			e.printStackTrace();
		}
	}
}
